<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>后台派送路径规划</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/aaa.css">
<script src="${pageContext.request.contextPath}/js/jquery-3.1.0.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<style type="text/css"></style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=BK1nKL02Lul9X8RURxIvqGhORqsGigsB"></script>
</head>

<body>
<img calss="img-responsive" width="100%" src="${pageContext.request.contextPath}/image/head.jpg" />
<div class="container">
  <div class="row">
    <div class="span12">
      <nav class="navbar navbar-inverse" role="navigation">
        <div class="container-fluid"> 
          <!-- Brand and toggle get grouped for better mobile display -->
          <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
            <a class="navbar-brand" href="#">后台管理</a> </div>
          
          <!-- Collect the nav links, forms, and other content for toggling -->
          <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
              <li><a href="${ pageContext.request.contextPath }/adminExpress_findByPageAll.action?page=1">订单管理</a></li>
              <li><a href="${ pageContext.request.contextPath }/adminExpress_findAllFromAddr.action">今日揽件路径规划</a></li>
              <li><a href="${ pageContext.request.contextPath }/adminPort_findAll.action">车场管理</a></li>
              <li class="active"><a href="#">今日派送路径规划</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
              <li><a href="${ pageContext.request.contextPath }/adminLogin_loginOut.action">注销</a></li>
              <li>
                <h4><span class="label label-success"><%=new Date().toLocaleString() %></span></h4>
              </li>
            </ul>
          </div>
          <!-- /.navbar-collapse --> 
        </div>
        <!-- /.container-fluid --> 
      </nav>
</div>
  </div>
  <div id="allmap" class="col-lg-12" style="height:600px"></div>
  <div class="col-lg-4 col-lg-offset-4 col-md-6 col-md-offset-6 col-sm-8 col-sm-offset-2">
    <button type="button" class="btn btn-info">规划路径 </button>
    
  </div>
</div>
</body>
</html>
<script type="text/javascript">
	// 百度地图API功能
	var map = new BMap.Map("allmap");    // 创建Map实例
	map.centerAndZoom("广州", 11);  // 初始化地图,设置中心点坐标和地图级别
	map.addControl(new BMap.MapTypeControl());   //添加地图类型控件
	map.setCurrentCity("北京");          // 设置地图显示的城市 此项是必须设置的
	map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
	var f=${requestScope["javaJson"]};
	var fromPoints=f.fromPoints;
	var opts = {
				width : 250,     // 信息窗口宽度
				height: 80,     // 信息窗口高度
				title : "地址" , // 信息窗口标题
				enableMessage:true//设置允许信息窗发送短息
			   };
	for(var i=0;i<fromPoints.length;i++){
		var marker = new BMap.Marker(new BMap.Point(fromPoints[i][0],fromPoints[i][1]));  // 创建标注
		var content = fromPoints[i][2];
		map.addOverlay(marker);               // 将标注添加到地图中
		addClickHandler(content,marker);
	}
	function addClickHandler(content,marker){
		marker.addEventListener("click",function(e){
			openInfo(content,e)}
		);
	}
	function openInfo(content,e){
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
</script>
